/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="goods_class_attr")
public class GoodsClassAttr implements Serializable {
	public GoodsClassAttr() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.GoodsClass goodsClass;
	
	private String className;
	
	private cn.imvc.app.entities.AttrClass attr;
	
	private String attrName;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_GOODSCLASSATTR_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_GOODSCLASSATTR_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 类型名称
	 */
	public void setClassName(String value) {
		this.className = value;
	}
	
	/**
	 * 类型名称
	 */
	@Column(name="className", nullable=true, length=255)	
	public String getClassName() {
		return className;
	}
	
	/**
	 * 属性名称
	 */
	public void setAttrName(String value) {
		this.attrName = value;
	}
	
	/**
	 * 属性名称
	 */
	@Column(name="attrName", nullable=true, length=255)	
	public String getAttrName() {
		return attrName;
	}
	
	public void setAttr(cn.imvc.app.entities.AttrClass value) {
		this.attr = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.AttrClass.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="attrId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.AttrClass getAttr() {
		return attr;
	}
	
	public void setGoodsClass(cn.imvc.app.entities.GoodsClass value) {
		this.goodsClass = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.GoodsClass.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="goodsClassId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.GoodsClass getGoodsClass() {
		return goodsClass;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("GoodsClassAttr[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getGoodsClass() != null)
				sb.append("GoodsClass.Persist_ID=").append(getGoodsClass().toString(true)).append(" ");
			else
				sb.append("GoodsClass=null ");
			sb.append("ClassName=").append(getClassName()).append(" ");
			if (getAttr() != null)
				sb.append("Attr.Persist_ID=").append(getAttr().toString(true)).append(" ");
			else
				sb.append("Attr=null ");
			sb.append("AttrName=").append(getAttrName()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
